#include <string.h>
#include <map.h>
#include "kingdom.h"

kPlanet::kPlanet(char *name, int size, int habitat, int type, int population) : pallegiances(Player::compare), 
		pfacilities(0){
	psize = size;
	pbabitat = habitat;
	ptype = type;
	ppopulation = population;
	
	pname = char[strlen(name)];
	strcpy(pname, name);
	
	pControl = kPlayer::defaultPlayer();
	pnumberorders = 0;
	porder = 0;
	pnumbermothballs = 0;
	pmothball = 0;
}

//TODO: Do something with this
kPlanet::~kPlayer() {
	delete pname;
}

const char *kPlanet::name() {
	return name;
}

const int kPlanet::size() {
	return size;
}

const int kPlanet::habitat() {
	return habitat;
}

const int kPlanet::type() {
	return type;
}

const int kPlanet::population() {
	return population;
}

const kPlayer *kPlanet::player() {
	return pcontrol;
}

const int kPlanet::numberOrders() {
	return pnumberorders;
}

const kPlanetOrder *kPlanet::order(int position) {
	kPlanetOrder *temp = porder;
	for(int i=0; i < position && temp != NULL; ++i)
		temp = temp->next;
	return temp;
}

const int kPlanet::numberShips() {
	return pnumbermothball;
}

const kShip
